#ifndef _PWM_H_
#define _PWM_H_

// --------------
// ---- PWM -----
// --------------

#define PWM_MAX 11059*2

inline void PWM_init()
{
	ICR1 = PWM_MAX;
	OCR1B = 0;//(int)(PWM_MAX * 0.0);
	TCCR1A |= (1<<COM1B1) | (1<<WGM11);
	TCCR1B |= (1<<WGM13) | (1<<CS11);
}

void PWM_fill(unsigned char fill)  // 255 = max wypelnienie
{
	if (fill < 10)
		OCR1B = 0;
	else
		//OCR1B = (int)( (float)PWM_MAX * (float)fill / 255 );
		OCR1B = (PWM_MAX >> 8)* fill;
}

#endif
